<?php defined('_JEXEC') or die('Restricted access'); 
/*
Copyright 2011 Erick Martínez Sámano

This file is part of PHP Quick Calendar E.

PHP Quick Calendar E is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PHP Quick Calendar E is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

<http://www.gnu.org/licenses/>
*/
jimport('joomla.form.form');
JHtml::_('behavior.calendar');$d = new DateTime( date('d-m-Y') );
$tp=$this->tipo; 
$l=explode('-',$this->fecha->refdate);
$Leyf=$l[2].'-'.$l[1].'-'.$l[0]; unset($l);
$form = &JForm::getInstance('naForm',dirname(__FILE__).DS."default.xml");
$chkd="checked='checked'";
?>
<style>
fieldset input, fieldset textarea, fieldset select, fieldset img, fieldset button{
	float:none;
}
</style>
<h1><?php echo JText::_('COM_PQCE_CHODATE');?></h1>
<form action="<?php echo JRoute::_( 'index.php' );?>" method="post" name="adminForm" id="adminForm">
<div class="col100">
<fieldset class="adminform">
		<legend><?php echo JText::_('COM_PQCE_EVNT');?></legend>
<div id="editcell" class="dQCE">
	<table class="adminlist">
		<tr class="row0">
			<td><?php echo $form->getLabel('refdate');?></td>
			<td><?php $Leyf= ($tp>=0)? $Leyf: $d->format('d-m-Y');$form->setValue('refdate',null,$Leyf); echo $form->getInput('refdate');unset($Leyf);?><img class="calendar" id="uo_img" src="templates/system/images/calendar.png" alt="calendario" /></td>
		</tr>
		<tr class="row1"><td><?php echo JText::_('COM_PQCE_TYPE');?>:</td>
			<td><table border="0" cellpadding="0" cellspacing="0">
<tr> <td><input type="radio" name="type" id="r0" value="0" <?php if ($tp<=0) echo $chkd;?>/></td><td><label for="r0"><?php echo JText::_('COM_PQCE_OO');?></label></td>
</tr><tr>
				<td><input type="radio" name="type" id="r1" value="1" <?php if ($tp==1) echo $chkd;?>/></td><td><label for="r1"><?php echo JText::_('COM_PQCE_ANNUAL');?></label></td>
</tr><tr>
				<td><input type="radio" name="type" id="r2" value="2" <?php if ($tp==2) echo $chkd;?>/></td><td><label for="r2"><?php echo JText::_('COM_PQCE_MONTHLY');?></label></td>
</tr><tr>
				<td><input type="radio" name="type" id="r4" value="4" <?php if ($tp==4) echo $chkd;?>/></td><td><label for="r4"><?php echo JText::_('COM_PQCE_WEEKLY');?></label></td>
</tr><tr>
				<td><input type="radio" name="type" id="r3" value="3" <?php if ($tp==3) echo $chkd;?>/></td><td><label for="r3"><?php echo JText::_('COM_PQCE_DAILY');?></label></td>
</tr>
			</table></td>
		</tr>
		<tr class="row0"><td style="color:#FF0000;"><?php echo $form->getLabel('enddate')?></td>
			<td><?php $d=explode('-',$this->fecha->enddate);$form->setValue('enddate',null,$d[2].'-'.$d[1].'-'.$d[0]); echo $form->getInput('enddate'); unset($d);?><img class="calendar" id="fe_img" src="templates/system/images/calendar.png" alt="calendario" /><button type="button" onclick="$('fe').value='00-00-0000';"><?php echo JText::_('COM_PQCE_RESTORE');?></button>
			</td>
		</tr>
		<tr class="row0"><td><?php echo JText::_('COM_PQCE_HR');?>:</td>
		<td> <?php echo JText::_('COM_PQCE_START').' ('.JText::_('COM_PQCE_HRMIN').') '; $l= JHTML::_('select.integerList',0,23,1,'hr','',$this->fecha->hr,"%02s"); echo $l.'<span style="font:bold 12px/1.6em Lucida Grande,Verdana,sans-serif">:</span>'; $l= JHTML::_('select.integerList',0,59,1,'min','',$this->fecha->min,"%02s"); echo $l;?><br /><br /><?php echo JText::_('COM_PQCE_END').' ('.JText::_('COM_PQCE_HRMIN').') '; $l= JHTML::_('select.integerList',0,23,1,'thr','',$this->fecha->thr,"%02s"); echo $l.'<span style="font:bold 12px/1.6em Lucida Grande,Verdana,sans-serif">:</span>'; $l= JHTML::_('select.integerList',0,59,1,'tmin','',$this->fecha->tmin,"%02s"); echo $l;?></td>
		</tr>
		<tr class="row1"><td><?php echo JText::_('COM_PQCE_CAT');?>:</td>
		<td><?php $l= JHTML::_('select.genericList',$this->catego,'category_id','','id','short_desc',$this->fecha->category_id); echo $l;?></td>
		</tr>
		<tr class="row0"><td><?php echo JText::_('COM_PQCE_LNKT');?>:</td> 
		<td><select name="link" id="slct"><option value='none' <?php if ($lnk=='none') {echo 'selected="selected"';} ?>><?php echo JText::_('COM_PQCE_NONE');?></option>
			<option value='url' <?php $lnk=$this->fecha->link; if ($lnk=='url') {echo 'selected= "selected"';} ?> ><?php echo JText::_('COM_PQCE_URLONLY');?></option>
			<option value='div' <?php if ($lnk=='div') {echo 'selected="selected"';} ?> >div</option></select></td>
		</tr>
		<tr class="row1"><td><label for="url" style="width:100%">URL:</label></td> 
		<td><input type="text" name="url" id="url" value="<?php echo $this->fecha->url; ?>" size="40" /></td>
		</tr>
		<tr class="row0"><td><label for="short_desc" id="sh_ds_l"><?php echo JText::_('COM_PQCE_SHORTDESC');?>:</label>
		<td><input type="text" name="short_desc" id="short_desc" size="100" maxlength="300" value="<?php echo $this->fecha->short_desc;?>" style="width:400px"/></td>
		</tr>
		<tr class="row1">
		<td style="vertical-align:top"><label for="long_desc"><?php echo JText::_('COM_PQCE_LONGDESC');?>:</label></td>
		<td><?php $editor =& JFactory::getEditor();echo $editor->display( 'long_desc', $this->fecha->long_desc, '400', '400', '20', '20' ,false);?></td>
		</tr>
		<tr class="row0">
		<td><?php echo JText::_('COM_PQCE_SMALLIMG');?>:</td>
		<td><?php 
			$tdesc=$this->fecha->short_desc_image;
			if ($tdesc!=''){
			$form->setValue('short_desc_image',null,$tdesc);}
			echo $form->getInput('short_desc_image');
			?></td>
		</tr>
		<tr class="row1">
		<td><?php echo JText::_('COM_PQCE_BIGIMG');?>:</td>
		<td><?php 
			$tdesc=$this->fecha->long_desc_image;
			if ($tdesc!=''){
			$form->setValue('long_desc_image',null,$tdesc);}
			echo $form->getInput('long_desc_image');
			?></td>
		</tr>
		<tr class="row0"><td><?php echo JText::_('COM_PQCE_ACT');?>:</td>
	<?php ($this->fecha->active===null)? $b=1 : $b=(int)$this->fecha->active;?>
			<td><table border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td><input type="radio" name="active" id="active0" value="0" <?php if (1-$b){ echo $chkd;};?>>
	</td><td><label for="active0"><?php echo JText::_('COM_PQCE_NO');?></label>
	</td><td><input type="radio" name="active" id="active1" value="1" <?php if ($b==1){ echo $chkd;};?>>
	</td><td><label for="active1"><?php echo JText::_('COM_PQCE_YES');?></label>
	</td>		</tr></table></td>
		</tr>
</table>
</div>
</fieldset>
</div>
<div class="clr"></div>
<input type="hidden" name="option" value="com_pqce" />
<input type="hidden" name="id" value="<?php echo $this->fecha->id;?>" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
<script type="text/javascript">
window.addEvent('domready', function() {Calendar.setup({
				inputField: "uo",
				ifFormat: "%d-%m-%Y",
				button: "uo_img",
				align: "Tl",
				singleClick: true,
				firstDay: 0
				});});
window.addEvent('domready', function() {Calendar.setup({
				inputField: "fe",
				ifFormat: "%d-%m-%Y",
				button: "fe_img",
				align: "Tl",
				singleClick: true,
				firstDay: 0
				});});
</script>
<?php JHtml::_('behavior.tooltip'); ?>
